package com.aeye.mbr.upms.server.controller.manage;

import com.aeye.mbr.common.base.BaseController;
import com.aeye.mbr.common.result.BootstrapTableParams;
import com.aeye.mbr.common.ui.validator.LengthValidator;
import com.aeye.mbr.upms.common.constant.UpmsResult;
import com.aeye.mbr.upms.common.constant.UpmsResultConstant;
import com.aeye.mbr.upms.dao.model.UpmsArea;
import com.aeye.mbr.upms.dao.model.UpmsOrganization;
import com.aeye.mbr.upms.dao.model.UpmsUser;
import com.aeye.mbr.upms.rpc.api.UpmsAreaService;
import com.aeye.mbr.upms.rpc.api.UpmsOrganizationService;
import com.baidu.unbiz.fluentvalidator.ComplexResult;
import com.baidu.unbiz.fluentvalidator.FluentValidator;
import com.baidu.unbiz.fluentvalidator.ResultCollectors;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;

/**
 * 区划controller
 * Created by shuaeye.mbr on 2017/2/6.
 */
@Controller
@Api(value = "行政区划管理", description = "行政区划管理")
@RequestMapping("/manage/area")
public class UpmsAreaController extends BaseController {

    private static Logger _log = LoggerFactory.getLogger(UpmsAreaController.class);

    @Autowired
    private UpmsAreaService upmsAreaService;

    @ApiOperation(value = "行政区划首页")
    @RequiresPermissions("upms:area:read")
    @RequestMapping(value = "/index", method = RequestMethod.GET)
    public String index() {
        return "/manage/area/index.jsp";
    }

    @ApiOperation(value = "行政区划列表")
    @RequiresPermissions("upms:area:read")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ResponseBody
    public Object list(
            BootstrapTableParams params,String parentCode) {
        return upmsAreaService.selectUpmsAreaByParams(params,parentCode);
    }
}
